import duckdb
import time

time_start=time.time()

conn =duckdb.connect(':default:')
cursor = conn.cursor()
cursor.execute("LOAD sqlite;")

for i in range(95,100,1):
    sqlitePath = "'D:\\Desktop\\duckdb\\DSP_Seeds" + str(i) + ".db'"

    cursor.execute("ATTACH " + sqlitePath + " AS SD" + str(i) + " (TYPE sqlite);")
    cursor.execute("USE SD" + str(i) + ";")
    cursor.execute("ATTACH 'new" + str(i) + ".duckdb' AS DD" + str(i) + ";")
    cursor.execute("INSERT INTO DD" + str(i) + ".seedStarsInfo SELECT * FROM SD" + str(i) + ".seedStarsInfo;")
    cursor.execute("INSERT INTO DD" + str(i) + ".seedPlanetsStringInfo SELECT * FROM SD" + str(i) + ".seedPlanetsStringInfo;")
    cursor.execute("INSERT INTO DD" + str(i) + ".seedResourcesInfo SELECT * FROM SD" + str(i) + ".seedResourcesInfo;")
    cursor.execute("INSERT INTO DD" + str(i) + ".seedGalaxiesInfo SELECT * FROM SD" + str(i) + ".seedGalaxiesInfo;")

cursor.close()
conn.close()

time_end=time.time()
print('totally cost',time_end-time_start)
print("finished ")
